﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ImageResizer
{
    public partial class AskNameDialog : Form
    {
        #region CTOR
        /// <summary>
        /// CTOR
        /// </summary>
        /// <param name="label">the labelname displayed</param>
        public AskNameDialog(string label, string defaultName)
        {
            InitializeComponent();
            labelName.Text = label;
            Text = label;
            textBox1.Text = defaultName;
            textBox1_TextChanged(null, null);
        } 

        #endregion

        /// <summary>
        /// The text which have been modified
        /// </summary>
        public string Result 
        {
            get
            {
                return textBox1.Text;
            }

            private set
            { 
            }

        }

 
        private void button1_Click(object sender, EventArgs e)
        {
            Result = textBox1.Text;
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }

       private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBox1.Text))
                button1.Enabled = false;
            else
                button1.Enabled = true;
        }
    }
}
